/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.fei.ClassDiagram.Editor.Wrappers;

import org.fei.ClassDiagram.XMI.XmiIdFactory;
import org.netbeans.modules.classfile.Field;

/**
 * Trieda ktora generalizuje to co maju spolocne metody, atributy, aj parametre metod
 * 
 * @author Tomas
 */
public class BasicClassElementWrapper {
    
    protected String name;
    protected String returnType;
    protected String xmiid;
    
    private static int emptyParamCounter = 0;

    public BasicClassElementWrapper(Field field) {
        
        this.name = field.getName();
        this.returnType = field.getDeclaration().split(" ")[0];
        
        if (name.isEmpty()) {
            name = "p" + emptyParamCounter;
            emptyParamCounter++;
        }
        this.xmiid = XmiIdFactory.getId();
    }
    
    public BasicClassElementWrapper(String name, String returnType) {
        
        this.name = name;
        this.returnType = returnType;
        
        this.xmiid = XmiIdFactory.getId();
    }
    
    public String getName() {
        return this.name;
    }
    
    public String getReturnType() {
        return this.returnType;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public void setReturnType(String returntype) {
        this.returnType = returntype;
    }
    
    public static void clearData() {
        emptyParamCounter = 0;
    }
}
